package com.cssy.yd.logic.service.impl;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.byd.acegiext.domain.User;
import com.cssy.yd.logic.dao.LogicPriceDetailsDAO;
import com.cssy.yd.logic.entity.LogicPoDO;
import com.cssy.yd.logic.entity.LogicPriceDetailsDO;
import com.cssy.yd.logic.service.ILogicPriceDetailsService;
import com.plat.exception.SyBaseException;
import com.plat.helper.SearchConditions;
import com.plat.helper.SearchResult;
import com.plat.util.IDCodeTypeUtil;

@Service("logicPriceDetailsService")
public class LogicPriceDetailsServiceImpl implements ILogicPriceDetailsService {

	@Resource(name="logicPriceDetailsDAO")
	private LogicPriceDetailsDAO logicPriceDetailsDAO;
	
	@Override
	public SearchResult findListByExample(SearchConditions scs)
			throws SyBaseException {
		SearchResult rs=new SearchResult(scs);
		List<LogicPriceDetailsDO>  list=logicPriceDetailsDAO.find(scs);
		rs.setRecordCount(logicPriceDetailsDAO.count(scs));
		rs.setResults(list);
		return rs;
	}

	@Override
	public Integer delete(String id, User user) throws SyBaseException {
		// TODO Auto-generated method stub
		return logicPriceDetailsDAO.deleteLogicPriceDetailsDOByPrimaryKey(id);
	}

	@Override
	public Integer update(LogicPriceDetailsDO t, User user)
			throws SyBaseException {
		t.setDuuser(user.getName());
		t.setDutime(new Date());
		logicPriceDetailsDAO.updateLogicPriceDetailsDO(t);
		return null;
	}

	@Override
	public LogicPriceDetailsDO save(LogicPriceDetailsDO t, User user)
			throws SyBaseException {
		t.setDcruser(user.getName());
		t.setDctime(new Date());
		t.setId(IDCodeTypeUtil.getId());
		logicPriceDetailsDAO.insertLogicPriceDetailsDO(t);
		return t;
	}

	@Override
	public LogicPriceDetailsDO findListById(String id) throws SyBaseException {
		// TODO Auto-generated method stub
		return logicPriceDetailsDAO.findLogicPriceDetailsDOByPrimaryKey(id);
	}

	@Override
	public List<LogicPriceDetailsDO> findListByExample(
			LogicPriceDetailsDO lDetailsDO) throws SyBaseException {
		// TODO Auto-generated method stub
		return logicPriceDetailsDAO.findListByExample(lDetailsDO);
	}

	@Override
	public Integer deleteBizRemoved(String id) throws SyBaseException {
		// TODO Auto-generated method stub
		return null;
	}

}
